<?php
include('../../../Redirect_includes.php');
if(GetTeacher(UserStaffID(),'','PROFILE',false)=='teacher')
{
	
	
	#$schedule_RET = DBGet(DBQuery("SELECT cp.PERIOD_ID,cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID FROM course_periods cp,courses c WHERE cp.COURSE_ID=c.COURSE_ID AND cp.TEACHER_ID='".UserStaffID()."' AND cp.SYEAR='".UserSyear()."'"),array('PERIOD_ID'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
	
	//$schedule_RET = DBGet(DBQuery("SELECT cp.PERIOD_ID,cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, ' to ', sp.END_TIME) AS DURATION FROM course_periods cp,courses c, school_periods sp WHERE cp.COURSE_ID=c.COURSE_ID AND cp.TEACHER_ID='".UserStaffID()."' AND cp.PERIOD_ID=sp.PERIOD_ID AND cp.SYEAR='".UserSyear()."'"),array('PERIOD_ID'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		$mp_select_RET = DBGet(DBQuery('SELECT DISTINCT cp.MARKING_PERIOD_ID, (SELECT TITLE FROM marking_periods WHERE MARKING_PERIOD_ID=cp.MARKING_PERIOD_ID) AS TITLE FROM course_periods cp,courses c, school_periods sp WHERE cp.COURSE_ID=c.COURSE_ID AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\' OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') AND cp.PERIOD_ID=sp.PERIOD_ID AND cp.SYEAR=\''.UserSyear().'\' AND cp.SCHOOL_ID=\''.UserSchool().'\''));
		$print_mp=CreateSelect($mp_select_RET, 'marking_period_id', 'Show All', 'Modules.php?modname='.$_REQUEST['modname'].'&include='.$_REQUEST['include'].'&category_id='.$_REQUEST['category_id'].'&marking_period_id=');
 

   
                echo '<div style="padding:10px 0px 0px 25px;"><strong>Marking Periods :</strong> '.$print_mp.'</div>';
  if(!$_REQUEST['marking_period_id'])
  {
		
		
			/******START TABLE*****/
			echo '<table class="grid" width="100%" align="center" cellpadding="6" cellspacing="1">';
					echo '<tr><td width=15% class="column_heading"><strong>Days</strong></td>';

					echo '<td width=40% class="column_heading"><strong>Course</strong></td>';
					echo '<td width=15% class="column_heading"><strong>Time</strong></td>';
					echo '<td width=10% class="column_heading"><strong>Room</strong></td>';
					echo '<td width=15% class="column_heading"><strong>Marking Period</strong></td>';
					echo '</tr>';

			//Start Monday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.MON=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Monday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Monday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Tuesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.TUE=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Tuesday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Tuesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Wednesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.WED=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Wednesday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Wednesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Thursday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.THU=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Thursday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Thursday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Friday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.FRI=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Friday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Friday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Saturday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.SAT=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Saturday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Saturday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Sunday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.SUN=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Sunday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Sunday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			echo "</table>";  
			/******END TABLE LÝ THUYẾT******/
			
			
			echo "<br/>";
			echo "<br/>";
			
			
			/******TABLE THỰC HÀNH******/
			/******START TABLE*****/
			echo '<table class="grid" width="100%" align="center" cellpadding="6" cellspacing="1">';
					echo '<tr><td width=15% class="column_heading"><strong>Days Practice </strong></td>';

					echo '<td width=40% class="column_heading"><strong>Course</strong></td>';
					echo '<td width=15% class="column_heading"><strong>Time</strong></td>';
					echo '<td width=10% class="column_heading"><strong>Room</strong></td>';
					echo '<td width=15% class="column_heading"><strong>Marking Period</strong></td>';
					echo '</tr>';

			//Start Monday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.MON_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Monday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Monday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Tuesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.TUE_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Tuesday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Tuesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Wednesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.WED_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Wednesday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Wednesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Thursday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.THU_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Thursday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Thursday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Friday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.FRI_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Friday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Friday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Saturday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.SAT_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Saturday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Saturday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Sunday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.SUN_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Sunday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Sunday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			echo "</table>";
			/******END TABLE THỰC HÀNH******/
			
  }
  else if($_REQUEST['marking_period_id'])
  {
		/*
		$schedule_RET = DBGet(DBQuery('SELECT cp.PERIOD_ID,cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
		FROM course_periods cp,courses c, school_periods sp 
		WHERE cp.COURSE_ID=c.COURSE_ID 
		AND cp.MARKING_PERIOD_ID=\''.$_REQUEST['marking_period_id'].'\' 
		AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\' OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
		AND cp.SCHOOL_ID=\''.UserSchool().'\' 
		AND cp.PERIOD_ID=sp.PERIOD_ID 
		AND cp.SYEAR=\''.UserSyear().'\' ORDER BY P_NAME')
		,array('PERIOD_ID'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		*/
		
		/******START TABLE*****/
			echo '<table class="grid" width="100%" align="center" cellpadding="6" cellspacing="1">';
					echo '<tr><td width=15% class="column_heading"><strong>Days</strong></td>';

					echo '<td width=40% class="column_heading"><strong>Course</strong></td>';
					echo '<td width=15% class="column_heading"><strong>Time</strong></td>';
					echo '<td width=10% class="column_heading"><strong>Room</strong></td>';
					echo '<td width=15% class="column_heading"><strong>Marking Period</strong></td>';
					echo '</tr>';

			//Start Monday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND cp.MARKING_PERIOD_ID=\''.$_REQUEST['marking_period_id'].'\' 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.MON=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Monday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Monday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Tuesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND cp.MARKING_PERIOD_ID=\''.$_REQUEST['marking_period_id'].'\' 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.TUE=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Tuesday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Tuesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Wednesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND cp.MARKING_PERIOD_ID=\''.$_REQUEST['marking_period_id'].'\' 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.WED=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Wednesday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Wednesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Thursday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND cp.MARKING_PERIOD_ID=\''.$_REQUEST['marking_period_id'].'\' 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.THU=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Thursday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Thursday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Friday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND cp.MARKING_PERIOD_ID=\''.$_REQUEST['marking_period_id'].'\' 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.FRI=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Friday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Friday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Saturday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND cp.MARKING_PERIOD_ID=\''.$_REQUEST['marking_period_id'].'\' 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.SAT=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Saturday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Saturday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Sunday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND cp.MARKING_PERIOD_ID=\''.$_REQUEST['marking_period_id'].'\' 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.SUN=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Sunday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Sunday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			echo "</table>";  
			/******END TABLE LÝ THUYẾT******/
			
			
			echo "<br/>";
			echo "<br/>";
			
			
			/******TABLE THỰC HÀNH******/
			/******START TABLE*****/
			echo '<table class="grid" width="100%" align="center" cellpadding="6" cellspacing="1">';
					echo '<tr><td width=15% class="column_heading"><strong>Days Practice </strong></td>';

					echo '<td width=40% class="column_heading"><strong>Course</strong></td>';
					echo '<td width=15% class="column_heading"><strong>Time</strong></td>';
					echo '<td width=10% class="column_heading"><strong>Room</strong></td>';
					echo '<td width=15% class="column_heading"><strong>Marking Period</strong></td>';
					echo '</tr>';

			//Start Monday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.MON_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Monday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Monday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Tuesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.TUE_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Tuesday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Tuesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Wednesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.WED_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Wednesday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Wednesday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Thursday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.THU_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Thursday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Thursday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Friday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.FRI_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Friday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Friday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Saturday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.SAT_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Saturday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Saturday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			//Start Sunday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			$schedule_RET = DBGet(DBQuery('SELECT cp.ROOM,c.TITLE,cp.COURSE_WEIGHT,cp.MARKING_PERIOD_ID, CONCAT(sp.START_TIME, \''.' to '.'\', sp.END_TIME) AS DURATION, sp.TITLE AS P_NAME 
			FROM course_periods cp,courses c, school_periods sp 
			WHERE cp.COURSE_ID=c.COURSE_ID 
			AND (cp.TEACHER_ID=\''.UserStaffID().'\' OR cp.SECONDARY_TEACHER_ID=\''.UserStaffID().'\'OR cp.TERTIARY_TEACHER_ID=\''.UserStaffID().'\') 
			AND cp.SUN_PRA=sp.PERIOD_ID 
			AND cp.SYEAR=\''.UserSyear().'\' 
			AND cp.SCHOOL_ID=\''.UserSchool().'\' ORDER BY P_NAME')
			,array('MON'=>'GetPeriod','MARKING_PERIOD_ID'=>'GetMP'));
		
			foreach($schedule_RET as $sch){
				echo '<tr class="even">';
				echo "<td rowspan='"."'>"."Sunday"."</td>";
				echo "<td>".$sch['TITLE']."</td>";
				echo "<td>".$sch['DURATION']."</td>";
				echo "<td>".$sch['ROOM']."</td>";
				echo "<td>".$sch['MARKING_PERIOD_ID']."</td></tr>";			
			}
			//End Sunday//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			echo "</table>";
			/******END TABLE THỰC HÀNH******/
  }
              
	//ListOutput($schedule_RET,array('TITLE'=>'Course','MON'=>'Period','DAYS'=>'Days','DURATION'=>'Time','ROOM'=>'Room','MARKING_PERIOD_ID'=>'Marking Period'),'Course','Courses');


	#ListOutput($schedule_RET,array('TITLE'=>'Course','PERIOD_ID'=>'Period','ROOM'=>'Room','MARKING_PERIOD_ID'=>'Marking Period'),'Course','Courses');
	#echo '<HR>';
}

$_REQUEST['category_id'] = 2;
include('modules/Users/includes/Other_Info.inc.php');

function CreateSelect($val, $name, $opt, $link='')
	{
	 	//$html .= "<table width=600px><tr><td align=right width=45%>";
		//$html .= $cap." </td><td width=55%>";
		if($link!='')
		$html .= "<select name=".$name." id=".$name." onChange=\"window.location='".$link."' + this.options[this.selectedIndex].value;\">";
		else
		$html .= "<select name=".$name." id=".$name." >";
		$html .= "<option value=''>".$opt."</option>";

				foreach($val as $key=>$value)
				{
					if($value[strtoupper($name)]==$_REQUEST[$name])
						$html .= "<option selected value=".$value[strtoupper($name)].">".$value['TITLE']."</option>";
					else
						$html .= "<option value=".$value[strtoupper($name)].">".$value['TITLE']."</option>";
				}



		$html .= "</select>";
		return $html;
	}
?>